package com.slz3.business.module.socialManagement.socDianzan.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.socialManagement.socDianzan.domain.SocDianzan;
import com.slz3.business.module.socialManagement.socDianzan.domain.SocDianzanFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class SocDianzanTransactionalServiceImpl implements SocDianzanTransactionalService {

    @Override
    public SocDianzan modify(SocDianzan socDianzanNew) {
        Repositorys.socDianzan.test();
        Repositorys.socDianzan.save(SocDianzanFactory.initBaseFields());
        System.err.println(1/0);
        socDianzanNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.socDianzan.saveAndFlush(socDianzanNew);
    }

    @Override
    public List<SocDianzan> batchModify(List<SocDianzan> socDianzanList) {
        return Repositorys.socDianzan.saveAll(socDianzanList);
    }
}
